<?php
/*
* 检测广告来源是否投标
*/
class AdTenderBehavior extends Behavior
{
    protected $options   =  array('TENDER_ON'=>true);

    public function run(&$params=array())
	{
		$AdRecord = session('AdRecord');
		if($this->options['TENDER_ON'] && !empty($AdRecord))
		{
			$DB = C('JD_DB');
			$data['memberid'] = $params['memberid'];
			$data['tender'] = 1;
			$data['tendermoney'] = array('exp',"`tendermoney` + {$params['money']}");
			$F = M($DB.'ad_record')->where(array('id'=>$AdRecord['id']))->save($data);
			return $F===false ? false : true;
		}
		return false;
    }
}

?>